<?php
$this->headTitle('Quản lý partner', 'append');

if(!$this->role){
    $link=null;$check_module=''; $check_contro=''; $check_action=''; ?>
    
<?php }
else{
    if(in_array('game',$this->role)){
        $link='admin/game/index/partnerId/';
        $check_module='admin'; $check_contro='game'; $check_action='index'; 
    }
    else if(in_array('user',$this->role)){
        $link='admin/user/index/partnerId/';
        $check_module='admin'; $check_contro='user'; $check_action='index'; 
    }
    else{
        $link='admin/role/index/partnerId/';
        $check_module='admin'; $check_contro='role'; $check_action='index'; 
    }
}
?>
<div class="grid">
    <div class="breadcrumbs">
        <a class="item-1" href="/index">Trang chủ</a> › 
        <a class="item-2" href="/default/partner"><?php $title = $this->headTitle(); if(isset($title[0])) echo $title[0]; ?></a>
        <div class="clear-both"></div>
    </div>
        <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <thead>
                <tr>
                    <td class="column">STT</td>
                    <td class="column">ID</td>
                    <td class="column">Tên partner</td>
                    <td class="column">Hình ảnh</td>
                  
                    <td class="column">Trạng thái</td>
                    <td class="column">
                        <?php  if($this->acl->checkResource($this->auth,'default','partner','add')){ ?>
                            <a class="bnt-add" href="<?php echo $this->url(array('module'=>'default', 'controller'=>'partner', 'action'=>'add'));?>">
                                Thêm mới
                            </a>
                        <?php }else{ ?>
    						Chức năng
                        <?php } ?>
                    </td>
                </tr>
            </thead>
            <tbody>
                <?php
                    $stt = 1;
                    foreach ($this->partnerList as $partner){
                ?>
                <tr class="row row-<?php echo $stt;?>">
                    <td class="column text-align-center"><?php echo $stt;?></td>
                    <td class="column text-align-center"><span class="blue"><?php echo $partner['partnerId'];?></span></td>
                    <td class="column">
                        <?php if($this->acl->checkResource($this->auth, $check_module, $check_contro, $check_action)){ ?>
							<a href="<?php if(!$link){echo "";}else{echo $link.$partner['partnerId'];}?>" title="Vào trang quản lý">
								<?php echo $partner['partnerName'];?>
							</a>
                        <?php }else{ ?>
							<span class="blue"><?php echo $partner['partnerName'];?></span>
						<?php } ?>
                    </td>
                    <td class="column text-align-center">
                        <?php  if($this->acl->checkResource($this->auth, $check_module, $check_contro, $check_action)){ ?>
							<a href="<?php if(!$link){echo "";}else{echo $link.$partner['partnerId'];}?>" title="Vào trang quản lý">
								<img src="<?php echo $partner['partnerImg']; ?>" alt="<?php echo $partner['partnerName'];?>" title="<?php echo $partner['partnerName'];?>" height="60px"/>
							</a>
                        <?php }else{ ?>
							<img src="<?php echo $partner['partnerImg']; ?>" alt="<?php echo $partner['partnerName'];?>" title="<?php echo $partner['partnerName'];?>" height="60px"/>
						<?php } ?>
                    </td>
                    
                    <td class="column text-align-center">
                        <?php
                            if($partner['status'] == 1){
                                echo '<img class="status" src="image/icons/icon_check.png" alt="Đang hoạt động" title="Đang hoạt động" border="0"/>';
                            }else{
                                echo '<img class="status" src="image/icons/icon_uncheck.png" alt="Đã Khóa" title="Đã khóa" border="0"/>';
                            }
                        ?>
                    </td>
                    <td class="column text-align-center">
                        <?php 
                            if($this->acl->checkResource($this->auth,'default','partner','edit')){ ?>
                            <a class="icon icon-edit" href="<?php echo $this->url(array('module'=>'default', 'controller'=>'partner', 'action'=>'edit', 'id'=>$partner['partnerId']));?>" title="Sửa thông tin partner">
                                <img src="image/icons/icon_edit.png" alt="edit partner" border="0"/>
                            </a>
                        <?php 
                            }
                            if($this->acl->checkResource($this->auth,'default','partner','delete')){
                                if($this->partnerCheck['partnerId'] != $partner['partnerId']){
                        ?>
                    			<a class="icon icon-delete" href="<?php echo $this->url(array('module'=>'default', 'controller'=>'partner', 'action'=>'delete', 'id'=>$partner['partnerId']));?>" title="Xóa partner">
                                    <img src="image/icons/icon_delete.png" alt="delete partner" border="0"/>
                                </a>
                        <?php 
                                }
                            } 
                        ?>
                    </td>
                </tr>
                <?php
                    ++$stt; 
                    } 
                ?>
            </tbody>
        </table>
</div>

